<?php

if ( ! defined('BASEPATH')) exit('No direct script access allowed');



/**

 * Insert Image with Link

 */

if ( ! function_exists('link_image')) {

	function link_image($link = '', $src = '', $link_attr = '', $image_attr = '')

	{

		//$rule = "/^(http:){1}$/i";

		$rule = "/^(http)/i";

		if (preg_match($rule, $link))

			$result = '<a href="'.($link).'" target="_blank">';

		else

			$result = '<a href="'.site_url($link).'" >';

		$result .= '<img border="0" src="'.base_url().$src.'" />';

		$result .= '</a>';

		return $result;

	}

}



/**

 * Use for left_menu in template_left.php

 */

if ( ! function_exists('menu_url')) {

	function menu_url($link, $name, $span)

	{

		$result = '<li>';

		if ($span)

			$result .= '<a href="'.site_url().'/'.$link.'"><span></span>'.$name.'</a>';

		else 

			$result .= '<a href="'.site_url($link).'">'.$name.'</a>';

		$result .= '</li>';

		return $result;

	}

}



/**

 * Insert Image with Attached File

 */

if ( ! function_exists('link_attached_file')) {

	function link_attached_file($file_path)

	{

		$file_path = base_url().$file_path;

		$result = '<p><a href="'.($file_path).'" target="_blank">';

		$result .= '<img border="0" src="'.base_url().'images/all/attached_file_en.png" />';

		$result .= '</a></p>';

		return $result;

	}

}


function get_link_image($name)
{
	return base_url()."images/home/".$name;
}
function get_js($name)
{
	echo '<script src="'.base_url()."include/js/".$name.'"  type="text/javascript"></script>';
}
?>